// import java.util.ArrayList;
// import java.util.Iterator;
// import java.util.List;
import java.util.*;
public class Col {

    public static void main(String[] args) {


        // list ==> array
        List<String> ll = List.of("apple","pear","watermelon","banana");
        String x =  ll.toString();
        System.out.println(x);
        System.out.println("==========================");

        // String[] ss = ll.toArray(new String[ll.size()]);
        String[] ss = ll.toArray(String[]::new);
        // System.out.println(Arrays.toString(ss));
        for(String s : ss){
            System.out.println(s);
        }
      

        // array ==> list
        Integer[] arr = {12,5,5,623,567,90};
        List<Integer> ls = List.of(arr);
        for(Integer n : ls){
            System.out.println(n);
        }

        System.out.println("=================== fengexian =====================");
        List<String> list = new ArrayList<>();
        list.add("hello");
        list.add("hello2");
        list.add("hello3");
      
       for(String st : list){
           System.out.println(st);
       }

        List<String> lklist = new LinkedList<>();
        lklist.add("a");
        lklist.add("b");
        lklist.add("c");
        lklist.add("d");
        lklist.add("e");
        lklist.add("f");
    
       for(String lk : lklist){
           System.out.println(lk);
       }




        // list.add(null);
        // list.add(null);
        // int size = list.size(); //5

        // String four = list.get(4); //null 是字符串类型

        // System.out.println(size);


        //遍历collection
        // List<String> l = List.of("apple","pear","watermelon","banana");
        
        // for(int i=0; i<l.size();i++){
        //     System.out.println(l.get(i));
        // }

        // System.out.println("====================================");

        // for(Iterator<String> it = l.iterator();it.hasNext();){
        //     String s = it.next();
        //     System.out.println(s);
        // }

        // System.out.println("====================================");

        // for(String s : l){
        //     System.out.println(s);
        // }


     

 
    //     final int start = 10;
    //     final int end   = 20;
    
    //     List<Integer> list = new ArrayList<>();
    //     for (int i = start; i <= end; i++) {
    //         list.add(i);
    //     }
     
    //     int removed = list.remove((int) (Math.random() * list.size()));
    //     System.out.println(removed);//14

    //     int found = findMissingNumber(start, end, list);
    //     System.out.println(list.toString());
    //     System.out.println("missing number: " + found);

    //     System.out.println(removed == found ? "测试成功" : "测试失败");


    // }

    // static int findMissingNumber(int start, int end, List<Integer> list) {
    //     int fo = -1;
    //     for(int i=0; i<list.size();i++){
    //         if(i+1 < list.size() && list.get(i+1) - list.get(i) > 1){
    //             fo = list.get(i+1) -1;
    //         }
    //     }
    //     return fo;
    // }


    }


         
}